<?php

namespace App\Admin\Http\Requests;

class ArticleRequest extends Request
{
    /**
     * 用户请求授权
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * 配置验证规则
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:100',
            'published_at' => 'required|date',
            'author' => 'required|max:50',
            'article_category_id' => 'required',
            'description' => 'max:200',
            'sort' => "required|integer",
            'content' => 'required'
        ];
    }

    /**
     * 验证的属性
     *
     * @return array
     */
    public function attributes()
    {
        return [
            'title' => '标题',
            'published_at' => '发布时间',
            'article_category_id' => '文章分类',
            'sort' => '排序',
            'description' => '备注',
            'author' => '作者',
            'content' => '内容'
        ];
    }
}